﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.Serialization.Formatters.Binary;
using System.Text;
using System.Threading.Tasks;

namespace NovoSerDes.Funcs
{
    public class SeriaDesria
    {

         static public void SeriazeObejct(object obj,string fileName)
        {
            BinaryFormatter formatter = new BinaryFormatter();
            using(FileStream stream = new FileStream(fileName, FileMode.Create))
            {
                formatter.Serialize(stream, obj);
            }
        }
        static public Object DeserializaObject(string fileName)
        {
            BinaryFormatter formatter = new BinaryFormatter();
            using(FileStream stream = new FileStream(fileName, FileMode.Open))
            {
                return formatter.Deserialize(stream);
            }
        }
    }
}
